package com.heima.home.mapper;


import com.heima.home.entity.ReviewLikes;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface ReviewLikesMapper {
    @Insert("insert into review_likes(review_id,user_id) values(#{reviewId},#{userId})")
    int addReviewLikes(ReviewLikes reviewLikes);
    @Select("select count(*) from review_likes where review_id=#{reviewId}")
    int countReviewLikes(Integer reviewId);
    @Delete("delete from review_likes where review_id= #{reviewId} and user_id= #{userId}")
    int deleteReviewLikes(ReviewLikes reviewLikes);
    @Select("select count(*) from review_likes where review_id= #{reviewId} and user_id= #{userId}")
    int isLiked(ReviewLikes reviewLikes);
}
